﻿@model Wiwi.ViewModels.ProfileView 
@{
    ViewBag.Title = "All " + @Model.Usr.FName +"'s Wants";
    var HomeDir = System.Configuration.ConfigurationManager.AppSettings["HomeDirectory"].ToString(); 
}

@* WiWi Profile *@

	<div class="grid_8 box-shadow margin-top user-profile-box">
    	<h4 class="tabbed">About @Model.Usr.FName</h4>
    
    	<img src="@Url.Action("ShowUserImage", "Home", new { Uid = @Model.Usr.UserID })" height="128" width="128" alt="@Model.Usr.FName @Model.Usr.Lname's avatar" />
    	
    	<div class="user-profile">
    		<h2>@Model.Usr.FName @Model.Usr.Lname</h2>
    		aka <span><em>@Model.Usr.UserID</em></span> @* !#! needs to be .UserName *@
    		<p>@Model.Usr.Bio</p>
    	</div>
      		
	</div>

	<div class="grid_5 box-shadow margin-top">
    	<h4 class="tabbed xWide">Keeps an eye on</h4>

    	@* !#! needs proper implementation, links  and text *@
    	<ul class="no-list padding">
    		<li><a href="#" class="green-button padding510"># Car Wheel Alloys</a></li>
    		<li><a href="#" class="green-button padding510"># Alarms</a></li>
    		<li><a href="#" class="green-button padding510"># Car Stereo</a></li>
    		<li><a href="#" class="green-button padding510"># Panel Beating</a></li>    		    		
    	</ul>
      	
    	<h6 class="margin-left">Recent Awards</h6>
       
    	 <p class="margin-left" style="line-height: 20px">Average Rating:<br />
          <img src="@HomeDir/content/i/stars/stars-3.png" alt="4 Star User" height="17" width="86" /><em> -Excellent Seller</em></p>
          <p class="margin-left"><a href="#!#">View all @Model.Usr.FName's Feedback</a></p> 
      		
	</div>
  
<!-- #end WiWi Profile -->

<div class="grid_8 box-shadow margin-top-small">
    	<h4 class="tabbed xWide">All @Model.Usr.FName's Wants</h4>
   
     @* implementation of wwi-pitches-box-thin.php  *@
      @foreach (var wnt in Model.Want)
      {      
         <div class="wiwi-pitches-box">
	
        <div class="left-col">
            <a href="/Home/UserPublicProfile?Uid=@wnt.UserID" ><img height ="48" width="48" src='@Url.Action("ShowUserImage", "Home", new { Uid = @wnt.UserID })' /></a>
        </div>

		<div class="right-col bigger-icon">
			<ul class="user-choice">
				<li><a href='/Want/Meto?Wid=@wnt.WantID' class="button-s green-button">Me2 !</a></li>
				<li><a href='/Want/Pitch?Wuid=@wnt.Want_Wanter_RelID.ToString()' class="button-s pitch">Pitch !</a></li>
			</ul>
	
	    	<h5>
               
               @if (wnt.WiwiDate.Value != null)
               {
                   string durat = "";
                   if (wnt.IsCreator == true) { durat = "Posted "; }
                   else { durat = "Me2'd "; }

                   TimeSpan span = DateTime.Now - wnt.WiwiDate.Value;
                   if (span.Minutes < 59 && span.Hours < 1 && span.Days < 1)
                   {
                       durat += span.Minutes.ToString() + " Minutes ago";
                   }
                   if (span.Hours > 1 && span.Days < 1)
                   {
                       durat += span.Hours.ToString() + " Hours ago";
                   }
                   if (span.Days > 1)
                   {
                       durat += span.Days.ToString() + " Days ago";
                   }
                 <span >@durat</span>
               }
               </h5>
	    	<p class="wiwi-content">@Html.ActionLink(wnt.WantDesc.ToString(), "WiwiDetails", "Home", new { wntID = wnt.WantID, UsrID = wnt.UserID }, null)</p>
          
            <p class='tagged'>Tagged~ 
             @if (wnt.Tags != "")
             {
                 string[] TagRows = wnt.Tags.Split('$');
                 foreach (string tr in TagRows)
                 {
                     if (tr != "")
                     {
                         string[] Tagss = tr.Split('?');
                         if (Tagss[0] != "")
                         {
                            <a href='/Want/Pitch?Wuid=@Tagss[1].ToString()'>@Tagss[0]</a>
                         }
                     }
                 }

             }
             </p>              

                @if (wnt.WantbyUsr != "")
                {
                    
            <div class="also-want grid_7">
            <p class="move-left">Also <br />wanted by</p>
            
                @{   	
             
                    string[] cntusrs = wnt.WantbyUsr.Split('$');
                    string[] usrs = cntusrs[0].Split('?');
                    foreach (string us in usrs)
                    {
                        if (us.Trim() != "")
                        {
                        <a href="/Home/UserPublicProfile?Uid=@us" ><img height ="32px" width="32" src='@Url.Action("ShowUserImage", "Home", new { Uid = @us })' /></a>
                        }
                    }
                    if (cntusrs.Length > 1)
                    {
                        if (int.Parse(cntusrs[1]) > 6)
                        {
                  <p class="move-right">   <a href="/Home/UserPublicProfile?Uid=@wnt.WantID" class="xOthers">and @cntusrs[1] others.</a></p>
                        }
                    }
                }

              </div>
         }            
             
	    </div>
	</div>  
        
	<hr />   
  }

  </div>

    
